home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc302emb.zip / LIBCF / SPRINTF.ASM < prev    next >
Assembly Source File  |  1994-03-18  |  517b  |  24 lines

  1. *
  2. * Formatter print to a string: sprintf(string, format, args ...)
  3. *
  4. sprintf    MULB    #2        Word entries
  5.     LEAI    ,S        Point to stack
  6.     ADAI            Point to argument
  7.     LD    I        Get output pointer
  8.     ST    ?temp        Save for later
  9.     TIA            Point to it
  10.     DEC            Backup
  11.     DEC            Backup
  12.     TAI            Back to index
  13.     LD    #?1        Output functino
  14.     CALL    format        Format it
  15.     CLR            Get zero
  16.     SJMP    ?2        And write it
  17. ?1    LD    2,S        Get character
  18. ?2    LDI    ?temp        Get output pointer
  19.     STB    I        Write to memory
  20.     LEAI    1,I        Advance
  21.     STI    ?temp        Resave
  22.     RET
  23. $EX:format
  24.